package com.gem.card;

import com.gem.entity.Card;
import com.gem.enums.CardType;
import com.gem.enums.GemType;
import com.gem.entity.Gem;

import java.util.ArrayList;
import java.util.List;

/**
 * Author: Xhy
 * CreateTime: 2022-09-17 15:34
 */
public class MediumCard extends Card {

    private Integer type = CardType.MEDIUM_CARD.getType();

    private static Integer no = 40;
    private static ArrayList<Card> cards = new ArrayList<>();

    /**
     * 初始化中级卡牌
     */
    static {
        cards.add(createMediumCardAndWhiteBuff(new Gem().white(2).blue(3).red(3),1));
        cards.add(createMediumCardAndWhiteBuff(new Gem().red(5),2));
        cards.add(createMediumCardAndWhiteBuff(new Gem().red(5).black(3),2));
        cards.add(createMediumCardAndWhiteBuff(new Gem().green(1).red(4).black(2),2));
        cards.add(createMediumCardAndWhiteBuff(new Gem().white(6),3));
        cards.add(createMediumCardAndWhiteBuff(new Gem().black(2).red(2).green(3),1));
        cards.add(createMediumCardAndRedBuff(new Gem().blue(3).red(2).black(3),1));
        cards.add(createMediumCardAndRedBuff(new Gem().white(1).blue(4).green(2),2));
        cards.add(createMediumCardAndRedBuff(new Gem().black(3).red(2).white(2),1));
        cards.add(createMediumCardAndRedBuff(new Gem().black(5),2));
        cards.add(createMediumCardAndRedBuff(new Gem().red(6),3));
        cards.add(createMediumCardAndRedBuff(new Gem().white(3).black(5),2));
        cards.add(createMediumCardAndBLUEBuff(new Gem().blue(6),3));
        cards.add(createMediumCardAndBLUEBuff(new Gem().blue(5),2));
        cards.add(createMediumCardAndBLUEBuff(new Gem().white(2).red(1).black(4),2));
        cards.add(createMediumCardAndBLUEBuff(new Gem().blue(2).green(3).black(3),1));
        cards.add(createMediumCardAndBLUEBuff(new Gem().white(5).blue(3),2));
        cards.add(createMediumCardAndBLUEBuff(new Gem().blue(2).green(2).red(3),1));
        cards.add(createMediumCardAndGreenBuff(new Gem().blue(5).green(3),2));
        cards.add(createMediumCardAndGreenBuff(new Gem().white(4).blue(2).black(1),2));
        cards.add(createMediumCardAndGreenBuff(new Gem().white(3).green(2).red(3),1));
        cards.add(createMediumCardAndGreenBuff(new Gem().white(2).black(2).blue(3),1));
        cards.add(createMediumCardAndGreenBuff(new Gem().green(5),2));
        cards.add(createMediumCardAndGreenBuff(new Gem().green(6),3));
        cards.add(createMediumCardAndBlackBuff(new Gem().green(5).red(3),2));
        cards.add(createMediumCardAndBlackBuff(new Gem().white(3).green(2).blue(2),1));
        cards.add(createMediumCardAndBlackBuff(new Gem().blue(1).green(4).red(2),2));
        cards.add(createMediumCardAndBlackBuff(new Gem().white(3).green(3).black(2),1));
        cards.add(createMediumCardAndBlackBuff(new Gem().white(5),2));
    }

    // init cards 30
    public static List<Card> init(){
        return cards;
    }

    public MediumCard(){}
    private MediumCard(Gem gem, Integer cardBuff, Integer score) {
        super.type = CardType.MEDIUM_CARD.type;
        super.gems = gem.toMap();
        super.cardBuff = cardBuff;
        super.score = score;
        super.no = no++;
    }

    private static MediumCard createMediumCardAndRedBuff(Gem gem,Integer score){
        return new MediumCard(gem, GemType.RED.getType(),score);
    }

    private static MediumCard createMediumCardAndWhiteBuff(Gem gem,Integer score){
        return new MediumCard(gem,GemType.WHITE.getType(),score);
    }

    private static MediumCard createMediumCardAndBlackBuff(Gem gem,Integer score){
        return new MediumCard(gem,GemType.BLACK.getType(),score);
    }

    private static MediumCard createMediumCardAndGreenBuff(Gem gem,Integer score){
        return new MediumCard(gem,GemType.GREEN.getType(),score);
    }

    private static MediumCard createMediumCardAndBLUEBuff(Gem gem,Integer score){
        return new MediumCard(gem,GemType.BLUE.getType(),score);
    }
}
